package recursivecontrol.extensions.view
{
	import flash.display.BitmapData;
	
	import handcraftedgames.geom.Axis;
	
	public class BitmapDataManipulator
	{
		public const ERROR_INVALID_AXIS_PARAM:String = "Invalid axis parameter.";
		/**
		 * Performs modifications to individual BitmapData objects:
		 * 
		 * -Rotation
		 * -Scaling 
		 * -Mirroring (flixel)
		 * -Colour overlay/flash (flixel) (also used for collision detection)
		 * (TODO) Colour cycling + caching ()
		 */
		
		public function BitmapDataManipulator()
		{
		}
		
		public function rotate(bmd:BitmapData, angleRad:Number):BitmapData
		{
			//(flixel, 8bitrocket)
			//http://blog.vfragosop.com/2010/10/slow-memory-allocation/
			//http://www.danielhai.com/blog/?p=38
			
			//1. use clone wherever possible rather than new
			//2. use copyPixels over fillRect
		}
		
		public function scale(bmd:BitmapData, scale:Number):BitmapData
		{
			//(flixel, 8bitrocket)
			//http://blog.vfragosop.com/2010/10/slow-memory-allocation/
			//http://www.danielhai.com/blog/?p=38
			
			//1. use clone wherever possible rather than new
			//2. use copyPixels over fillRect
		}
		
		public function mirror(bmd:BitmapData, axis:int):BitmapData
		{
			//(flixel)
			//http://blog.vfragosop.com/2010/10/slow-memory-allocation/
			//http://www.danielhai.com/blog/?p=38
			
			//1. use clone wherever possible rather than new
			//2. use copyPixels over fillRect
			switch(axis)
			{
				case Axis.HORIZONTAL:
					//TODO
					break;
				case Axis.VERTICAL:
					//TODO
					break;
				default: throw new Error(ERROR_INVALID_AXIS_PARAM);
			}
		}
		
		//TODO colour be RGB or ARGB?
		public function flash(bmd:BitmapData, colour:uint = 0xFFFFFF):BitmapData
		{
			//(flixel)
			//http://blog.vfragosop.com/2010/10/slow-memory-allocation/
			//http://www.danielhai.com/blog/?p=38
			
			//1. use clone wherever possible rather than new
			//2. use copyPixels over fillRect
		}
	}
}